package com.future.direction.ui.fragment;

import android.content.Intent;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.future.direction.R;
import com.future.direction.common.util.StatusBarUtil;
import com.future.direction.common.util.UIUtil;
import com.future.direction.di.component.AppComponent;
import com.future.direction.presenter.VersionPresenter;
import com.future.direction.ui.activity.AboutActivity;
import com.future.direction.ui.activity.AccountActivity;
import com.future.direction.ui.activity.BankCardListActivity;
import com.future.direction.ui.activity.ConvertActivity;
import com.future.direction.ui.activity.CourseActivity;
import com.future.direction.ui.activity.TeamActivity;
import com.future.direction.ui.activity.StudyRecordsActivity;
import com.future.direction.ui.activity.OrderActivity;
import com.future.direction.ui.activity.PersonInfoActivity;
import com.future.direction.ui.activity.SettingActivity;
import com.future.direction.ui.activity.VipActivity;
import com.future.direction.ui.activity.WebViewActivity;
import com.future.direction.ui.widget.CircleImageView;
import com.future.direction.ui.widget.RedTipRechImageView;

import javax.inject.Inject;

import butterknife.BindView;


/**
 * Created by zhangpeng on 2017/11/23.
 */

public class MainMineFragment extends BaseFragment implements View.OnClickListener {

    @Inject
    VersionPresenter mVersionPresenter;
    @BindView(R.id.red_mine_message)
    RedTipRechImageView redMineMessage;
    @BindView(R.id.civ_noun)
    CircleImageView civNoun;
    @BindView(R.id.tv_login_name)
    TextView tvLoginName;
    @BindView(R.id.tv_level)
    TextView tvLevel;
    @BindView(R.id.tv_code)
    TextView tvCode;
    @BindView(R.id.tv_copy)
    TextView tvCopy;
    @BindView(R.id.ll_level)
    LinearLayout llLevel;
    @BindView(R.id.tv_mine_study)
    TextView tvMineStudy;
    @BindView(R.id.tv_mine_buy)
    TextView tvMineBuy;
    @BindView(R.id.tv_mine_invite)
    TextView tvMineInvite;
    @BindView(R.id.tv_mine_account)
    TextView tvMineAccount;
    @BindView(R.id.iv_mine_join)
    ImageView ivMineJoin;
    @BindView(R.id.rl_mine_change)
    RelativeLayout rlMineChange;
    @BindView(R.id.rl_mine_team)
    RelativeLayout rlMineTeam;
    @BindView(R.id.rl_mine_course)
    RelativeLayout rlMineCourse;
    @BindView(R.id.rl_mine_about)
    RelativeLayout rlMineAbout;
    @BindView(R.id.rl_mine_setting)
    RelativeLayout rlMineSetting;
    @BindView(R.id.rl_content)
    RelativeLayout rlContent;


    @Override
    public int setLayout() {
        StatusBarUtil.transparencyBar2(getActivity());
        StatusBarUtil.setLightStatusBar(getActivity(), true);
        return R.layout.fragment_mine;
    }


    @Override
    protected void getExtras() {

    }

    @Override
    public void init() {


    }

    @Override
    protected void setListener() {
        redMineMessage.setOnClickListener(this);
        tvLoginName.setOnClickListener(this);
        civNoun.setOnClickListener(this);
        tvMineStudy.setOnClickListener(this);
        tvMineBuy.setOnClickListener(this);
        tvMineInvite.setOnClickListener(this);
        tvMineAccount.setOnClickListener(this);
        ivMineJoin.setOnClickListener(this);
        rlMineChange.setOnClickListener(this);
        rlMineTeam.setOnClickListener(this);
        rlMineCourse.setOnClickListener(this);
        rlMineAbout.setOnClickListener(this);
        rlMineSetting.setOnClickListener(this);


        //TODO
        tvMineAccount.setVisibility(View.VISIBLE);
        rlMineTeam.setVisibility(View.VISIBLE);
    }

    @Override
    public void setupAcitivtyComponent(AppComponent appComponent) {

    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.red_mine_message:
                startActivity(new Intent(UIUtil.getContext(), PersonInfoActivity.class));
                break;
            case R.id.tv_login_name:
                goLogin();
                break;
            case R.id.civ_noun:
                startActivity(new Intent(UIUtil.getContext(), VipActivity.class));
                break;
            case R.id.tv_mine_study:
                startActivity(new Intent(UIUtil.getContext(), StudyRecordsActivity.class));
                break;
            case R.id.tv_mine_buy:
                startActivity(new Intent(UIUtil.getContext(), OrderActivity.class));
                break;
            case R.id.tv_mine_invite:
                //TODO 邀请好友
                WebViewActivity.launcher(UIUtil.getContext(),"www.baidu.com","邀请好友");
                break;
            case R.id.tv_mine_account:
                startActivity(new Intent(UIUtil.getContext(), AccountActivity.class));
                break;
            case R.id.iv_mine_join:
                startActivity(new Intent(UIUtil.getContext(), BankCardListActivity.class));
                break;
            case R.id.rl_mine_change:
                startActivity(new Intent(UIUtil.getContext(), ConvertActivity.class));
                break;
            case R.id.rl_mine_team:
                startActivity(new Intent(UIUtil.getContext(), TeamActivity.class));
                break;
            case R.id.rl_mine_course:
                startActivity(new Intent(UIUtil.getContext(), CourseActivity.class));
                break;
            case R.id.rl_mine_about:
                startActivity(new Intent(UIUtil.getContext(), AboutActivity.class));
                break;
            case R.id.rl_mine_setting:
                startActivity(new Intent(UIUtil.getContext(), SettingActivity.class));
                break;
        }
    }

}
